<template>
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-6 p-3">
                <div class="card">
                    <div class="card-title">TEAM1</div>
                    {{ score1 }}
                </div>
            </div>
            <div class="col-md-6 p-3">
                <div class="card">
                    <div class="card-title">TEAM2</div>
                    {{ score2 }}
                </div>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    props:[
        's1', 's2'
    ],
    data() {
        return {
            score1: this.s1,
            score2: this.s2,
        }
    },
    mounted() {
        window.Echo.channel('score').listen('ScoreChangedEvent', (res) => {
            res.score.team === '1' ? this.score1 = res.score.score : this.score2 = res.score.score
        })
        window.Echo.channel('who_rushed').listen('RushedEvent', (res) => {
            console.log(res.who_rushed)
        })
    }
}
</script>
